package com.longe.controller;

import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 这个类中演示角色注解
 */
@Controller
@RequestMapping("goods")
public class GoodsController {

    @RequestMapping("detail")
    @RequiresRoles(value={"admin","user"},logical = Logical.OR)
    public String detail(){

        return "/goods/detail";
    }

    @RequestMapping("add")
    @RequiresRoles({"admin"})
    public String add(){

        return "/goods/add";
    }

    @RequestMapping("update")
    public String update(){

        return "/goods/update";
    }

    @RequestMapping("delete")
    @RequiresRoles({"admin"})
    public String delete(){

        return "/goods/delete";
    }

    @RequestMapping("query")
    @RequiresRoles(value={"admin","user"},logical = Logical.OR)
    public String query(){

        return "/goods/query";
    }
}
